import { Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
import { BannerType } from "./banner_type.entity";

@Entity()
export class BannerData {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({
    comment: "标题",
    nullable: true
  })
  title: string;

  @Column({
    comment: "url 地址",
    nullable: true
  })
  url: string;

  @Column({
    comment: "1普通 2外链 3内置路由"
  })
  type: string;

  @Column({
    comment: "排序",
    type: "int",
    default: 0
  })
  sort: number;

  @Column({
    comment: "文件地址"
  })
  file: string;

  @ManyToOne(() => BannerType, (data) => data.bannerData)
  bannerType: BannerType;

  @CreateDateColumn()
  createTime: Date;

}